<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<script>

description('Tests the name of the event parameter for inline event attributes');

function dispatchClick(element)
{
    var clickEvent = document.createEvent('MouseEvent');
    clickEvent.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
    element.dispatchEvent(clickEvent);
}

var type;
var div = document.createElement('div');

// Clear out window.event so that we get the local event and not the global event.
div.setAttribute('onclick', 'window.event = undefined; type = typeof event');
dispatchClick(div);
shouldBeEqualToString('type', 'object')

div.setAttribute('onclick', 'type = typeof evt');
dispatchClick(div);
shouldBeEqualToString('type', 'undefined')

var SVG_NS = 'http://www.w3.org/2000/svg';
var svg = document.createElementNS(SVG_NS, 'circle');

// Clear out window.event so that we get the local event and not the global event.
svg.setAttribute('onclick', 'window.event = undefined; type = typeof event');
dispatchClick(svg);
shouldBeEqualToString('type', 'undefined')

svg.setAttribute('onclick', 'type = typeof evt');
dispatchClick(svg);
shouldBeEqualToString('type', 'object')

</script>
